package com.yanqu.road.server.manager.config;

import com.yanqu.road.dao.impl.curio.CurioConfigDaoImpl;
import com.yanqu.road.entity.curio.config.CurioItemInfo;
import com.yanqu.road.server.TempMgr;

import java.util.Map;

public class CurioConfigMgr extends TempMgr {

    /**
     * 藏品
     */
    private static Map<Integer, CurioItemInfo> itemInfoMap;
    @Override
    public boolean init() throws Exception {
        return reload();
    }

    public CurioConfigMgr() {
    }

    @Override
    public boolean reloadConfig() throws Exception {
        Map<Integer, CurioItemInfo> tempItemInfoMap = new CurioConfigDaoImpl().getCurioItemInfo();
        itemInfoMap = tempItemInfoMap;
        return true;
    }

    @Override
    public boolean reloadData() throws Exception {
        return true;
    }

    @Override
    public boolean stop() {
        return true;
    }

    public static CurioItemInfo getCurioItemInfo(int id){
        return itemInfoMap.get(id);
    }

    public static Map<Integer, CurioItemInfo> getItemInfoMap() {
        return itemInfoMap;
    }

    public static void setItemInfoMap(Map<Integer, CurioItemInfo> itemInfoMap) {
        CurioConfigMgr.itemInfoMap = itemInfoMap;
    }

}
